package com.qiyue.admin.auth.utils.model.impl;

import com.qiyue.admin.auth.utils.model.IJWTInfo;

import java.io.Serializable;

/**
 * Created with Intellij IDEA.
 * User : Yebinghuan
 * Created on 2018/2/10.
 * Description :
 */
public class JWTInfo  implements Serializable,IJWTInfo {

    //用户账号
    private String account;
    //用户Id
    private String userId;
    //用户名
    private String name;


    public JWTInfo(String account, String userId, String name) {
        this.account = account;
        this.userId = userId;
        this.name = name;
    }

    @Override
    public String getAccount() {
        return account;
    }

    @Override
    public String getId() {
        return userId;
    }

    @Override
    public String getName() {
        return name;
    }


    public void setAccount(String account) {
        this.account = account;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        JWTInfo jwtInfo = (JWTInfo) o;

        if (account != null ? !account.equals(jwtInfo.account) : jwtInfo.account != null) return false;
        if (userId != null ? !userId.equals(jwtInfo.userId) : jwtInfo.userId != null) return false;
        return name != null ? name.equals(jwtInfo.name) : jwtInfo.name == null;
    }

    @Override
    public int hashCode() {
        int result = account != null ? account.hashCode() : 0;
        result = 31 * result + (userId != null ? userId.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        return result;
    }


    @Override
    public String toString() {
        return "JWTInfo{" +
                "account='" + account + '\'' +
                ", userId='" + userId + '\'' +
                ", name='" + name + '\'' +
                '}';
    }
}
